import {Component, OnDestroy, OnInit, ViewEncapsulation} from '@angular/core';
import {ActivatedRoute} from "@angular/router";
import {ImageServeService} from "@shared/service/image/image-serve.service";
import {AuthService} from "@shared/service/auth/auth.service";
import {TacticalService} from "@train/tactical/tactical.service";
import {Subject} from "rxjs/Rx";
import {BaseDictCommonVO} from "@interface/index";

@Component({
  selector: 'seed-train-tactical',
  templateUrl: './tactical.component.html',
  styleUrls: ['./tactical.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class TrainTacticalComponent implements OnInit, OnDestroy {
  public ngUnsubscribe: Subject<void> = new Subject<void>();
  public arr: BaseDictCommonVO[];
  constructor(
    private activatedRoute: ActivatedRoute,
    private authService: AuthService,
    private tacticalService: TacticalService
  ) {
    // activatedRoute.params.subscribe(params => {
    //
    // })
    activatedRoute.queryParams.subscribe(param => {
      // this.authOrgId = param['authOrgId'];
      authService.setAuthOrgId(param['authOrgId']);
      this.fetchSportType();
    });
  }
  /**
   * @author 欧晓辉
   * @time 2018/3/9
   * @description 获取战术板运动类型
   */
  fetchSportType() {
    this.tacticalService.findSportType()
      .takeUntil(this.ngUnsubscribe)
      .subscribe(res => {
        this.arr = res.data.dicts;
      });
  }
  ngOnInit() {

  }

  ngOnDestroy() {
    this.ngUnsubscribe.next();
    this.ngUnsubscribe.complete();
  }

}
